local app = GetApp()
local w, h = app:Size()
app.main = Widget(app, 0, 0, w, h)
app.main.Paint = function(self, g)
	local w, h = self:Size()
	g:SetColor(0xFF208080)
	g:FillRect(0, 0, w, 32)
	g:SetColor(0xFFFFFFFF)
	g:DrawText(0, 0, w, 32, "我的超级移动App", Justification.centred)
end

local nodes = {}
function call_back(name, id, type, version)
	table.insert(nodes, {name, id, type, version})
end
juce.res_list(nil, call_back)

app.main.slide = Slide(app.main, 0, 32, w, 256)
app.main.slide.images = {"Image.image1", "Image.image2"}
app.main.slide.MouseUp = function(self)
	juce.MessageBox("选择页面", self.images[self.active])
end

app.main.tabbed = Tabbed(app.main, 0, 288, w, 32)
app.main.tabbed.texts = {"新闻", "财经", "资讯", "体育"}

--app.main.ok = Button(app.main, 10, 500, 80, 32, "你好")
--main_page.ok["Click"] = function(self)
--	self._parent.cancel:SetText("NiHao!")
--end
--main_page.cancel = Button(main_page, 420, 360, 80, 32, "World")
--main_page.input = Editor(main_page, 300, 400, 100, 24)

--app.main.ok["Click"] = function(self)
--	self._parent:Show(false)
--	local app = GetApp()
--	app.splash:Show(true)
--end 

app.splash = Widget(app, 0, 0, w, h)
app.splash.exit = Button(app.splash, 0, 0, 60, 28, "返回")
app.splash.exit.Click = function(self)
	self._parent:Show(false)
	local app = GetApp()
	app.main:Show(true)
end
app.splash.Paint = function(self, g)
	local w, h = self:Size()
	g:SetColor(0xFF000000)
	g:FillRect(0, 0, w, h)
	g:SetColor(0xFF208080)
	g:FillRect(0, 0, w, 32)
	g:SetColor(0xFFFFFFFF)
	g:DrawText(0, 0, w, 32, "这是一个详细App页面", Justification.centred)
end

app.main.listview = ListView(app.main, 0, 320, w, 400)
for k, v in pairs(nodes) do
	app.main.listview:AddItem("<font bold color=0xFFFF0000 size=22> 我的移动App</font>"..v[1].." ID= "..v[2].." type= "..v[3].." date= "..os.date("%c", v[4]), 32, 0x80FFFFFF)
end
app.main.listview:AddItem("<image node=Image.galaxy align=right><font bold color=0xFFFFFF00 size=20> 我的移动App</font>ABCDEFGHIJKLMNOPQRSTUV我不是珠WXY<font color=0xFF123456>XXXZABCDEFGZZXXX</font>HIJKLMNOPQRESTUVWXYZ", 80, 0xFFFFFFFF)
app.main.listview:AddItem("<image node=Image.galaxy><font bold color=0xFFFFFF00 size=20> 我的移动App</font>ABCDEFGHIJKLMNOPQRSTUV我不是珠WXY<font color=0xFF123456>XXXZABCDEFGZZXXX</font>HIJKLMNOPQRESTUVWXYZ", 80, 0xA0FFFFFF)
app.main.listview:AddItem("<image node=Image.galaxy align=right><font bold color=0xFFFFFF00 size=20> 我的移动App</font>ABCDEFGHIJKLMNOPQRSTUV我不是珠WXY<font color=0xFF123456>XXXZABCDEFGZZXXX</font>HIJKLMNOPQRESTUVWXYZ", 80, 0x80FFFFFF)
app.main.listview:AddItem("<image node=Image.galaxy><font bold color=0xFFFFFF00 size=20> 我的移动App</font>ABCDEFGHIJKLMNOPQRSTUV我不是珠WXY<font color=0xFF123456>XXXZABCDEFGZZXXX</font>HIJKLMNOPQRESTUVWXYZ", 80, 0xA0FFFFFF)
app.main.listview:AddItem("<image node=Image.galaxy align=right><font bold color=0xFFFFFF00 size=20> 我的移动App</font>ABCDEFGHIJKLMNOPQRSTUV我不是珠WXY<font color=0xFF123456>XXXZABCDEFGZZXXX</font>HIJKLMNOPQRESTUVWXYZ", 80, 0xA0FFFFFF)
--app.main.listview:AddItem("<image node=TestApp.galaxy><font bold color=0xFFFFFF00 size=20> 我的移动App</font>ABCDEFGHIJKLMNOPQRSTUV我不是珠WXY<font color=0xFF123456>XXXZABCDEFGZZXXX</font>HIJKLMNOPQRESTUVWXYZ", 80, 0x80FFFFFF)
--app.main.listview:AddItem("<image node=TestApp.galaxy align=right><font bold color=0xFFFFFF00 size=20> 我的移动App</font>ABCDEFGHIJKLMNOPQRSTUV我不是珠WXY<font color=0xFF123456>XXXZABCDEFGZZXXX</font>HIJKLMNOPQRESTUVWXYZ", 80, 0xA0FFFFFF)
--app.main.listview:AddItem("<image node=TestApp.galaxy><font bold color=0xFFFFFF00 size=20> 我的移动App</font>ABCDEFGHIJKLMNOPQRSTUV我不是珠WXY<font color=0xFF123456>XXXZABCDEFGZZXXX</font>HIJKLMNOPQRESTUVWXYZ", 80, 0x80FFFFFF)
app.main.listview:Update()

app.main:Show(true)

--widget.input = Editor(widget, 300, 300, 100, 24)

